/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package db;

import java.util.ArrayList;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

/**
 *
 * @author titnana
 */
@WebService()
public class databaseWS {

    /**
     * Web service operation
     */
    @WebMethod(operationName = "getdata")
    public String getdata(@WebParam(name="n") int n) {
        ArrayList<String> data = new ArrayList<String>();
        data.add("Cecile");
        data.add("Mikael");
        data.add("Anais");
        return data.get(n);
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "addArticle")
    public String addArticle(@WebParam(name="a") String a) {
        ArrayList<String> listArticles = new ArrayList<String>();
        listArticles.add(a);
        return "Félicitations ! L'article '"+a+"' a bien été ajouté.";
    }


    @WebMethod(operationName = "getPreviousOwner")
    public String getPreviousOwner(@WebParam(name="article") String article) {
        String prev;
        // On suppose qu'on récupère l'adresse mail de l'ancien enchéreur
        // via le nom de l'article
        prev = "rokokokokoko@gmail.com";
        return prev;
    }

    @WebMethod(operationName = "notifEnchere")
    public void notifEnchere(@WebParam(name="article") String article) {
        System.out.println("Lancement d'une notification sur enchere");
    }

}
